﻿using GC_VKMD.MusicDownloaderClient.Abstractions.Interfaces.Factories.ViewModel;
using GC_VKMD.MusicDownloaderClient.Abstractions.Interfaces.Helpers;
using GC_VKMD.MusicDownloaderClient.ViewModels;
using GC_VKMD.MusicDownloaderClient.ViewModels.Parameters;

namespace GC_VKMD.MusicDownloaderClient.Factories.ViewModel
{
	public class MusicDownloaderSettingsViewModelFactory : IMusicDownloaderSettingsViewModelFactory
	{
		#region Variables

		private readonly IBrowserDialog _browserDialog;
		private readonly IApplicationConfiguration _applicationConfiguration;

		#endregion

		#region Constructors

		public MusicDownloaderSettingsViewModelFactory(IBrowserDialog browserDialog, IApplicationConfiguration applicationConfiguration)
		{
			_browserDialog = browserDialog;
			_applicationConfiguration = applicationConfiguration;
		}

		#endregion

		#region IMusicDownloaderViewModelFactory Members

		public MusicDownloaderSettingsViewModel Create(MusicDownloaderSettingsViewModelParameters parameters)
		{
			if (parameters != null)
			{
				parameters.BrowserDialog = _browserDialog;
				parameters.ApplicationConfiguration = _applicationConfiguration;
			}

			return new MusicDownloaderSettingsViewModel(parameters);
		}

		#endregion
	}
}
